package vn.edu.saigontech.ncms.model.info;

import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.OptimisticLockType;

import vn.edu.saigontech.ncms.model.BaseEntity;
import vn.edu.saigontech.ncms.model.system.Money;
import vn.edu.saigontech.ncms.model.user.User;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true, optimisticLock = OptimisticLockType.ALL)
@Table(name = "ncms_internal_receipt")
@SuppressWarnings("serial")
public class InternalReceipt extends BaseEntity {
	
	@Column(name = "number")
	protected String number;

	@Temporal(TemporalType.DATE)
	@Column(name = "date", nullable = false)
	protected Date date;

	@Embedded
	@AttributeOverrides( {
			@AttributeOverride(name = "amount", column = @Column(name = "fee")),
			@AttributeOverride(name = "currency", column = @Column(name = "fee_currency")), })
	protected Money fee;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cashier_id", nullable = false)
	protected User cashier;

	@Column(name = "active")
	protected boolean active;

	@Column(name = "comment", length = 4000)
	protected String comment;
	
	@Column(name = "name", length = 255)
	protected String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getReceiptComment() {
		return this.comment;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Money getFee() {
		return fee;
	}

	public void setFee(Money fee) {
		this.fee = fee;
	}

	public User getCashier() {
		return cashier;
	}

	public void setCashier(User cashier) {
		this.cashier = cashier;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}
}